package com.pap.itemfeignapi;

import com.pap.itemfeignapi.dto.ItemSkuDTO;
import com.pap.obj.vo.response.ResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.math.BigDecimal;

@FeignClient(value = "${pap-item:pap-item}", path = "${pap-item-path:}", contextId = "itemSkuService", fallbackFactory=ItemSkuServiceFeignFactory.class)
public interface IItemSkuService {

    /**
     * 获取商品信息
     * @param id
     * @return
     */
    @GetMapping(value = "/itemsku/{id}")
    public ResponseVO<ItemSkuDTO> selectOne(@PathVariable("id") String id);

    /**
     * 获取商品定价
     * @param papToken
     * @param papVersion
     * @param itemSkuId
     * @return
     */
    @GetMapping(value = "/itemprice/{itemSkuId}")
    public ResponseVO<BigDecimal> selectItemPriceByItemSkuId(@RequestHeader(value = "papToken", defaultValue = "-1") String papToken,
                                                             @RequestHeader(value = "papVersion", defaultValue = "1.0") String papVersion,
                                                             @PathVariable("itemSkuId") String itemSkuId);

}
